package com.tg.message.adapter;

import android.annotation.SuppressLint;

import androidx.annotation.NonNull;

import com.tg.data.bean.DeviceItem;
import com.tg.data.http.entity.WheelData;
import com.tg.message.R;

import java.util.List;

public class MessageDeviceAdapter extends DateAdapter{
    private final List<DeviceItem> list;
    public MessageDeviceAdapter(List<DeviceItem> data) {
        list = data;
    }

    @Override
    public void onBindViewHolder(@NonNull MessageDateViewHolder holder, @SuppressLint("RecyclerView") final int position) {
        if (position == 0) {
            holder.dateText.setText(R.string.all_devices);
            super.onBindViewHolder(holder, position);
            return;
        }
        DeviceItem deviceItem = list.get(position - 1);
        holder.dateText.setText(deviceItem.name);
        super.onBindViewHolder(holder, position);
    }

    public String getDateText(int position){
        if (position == 0) {
            return "全部设备";
        }

        DeviceItem deviceItem = list.get(position - 1);
        return deviceItem.name;
    }

    @Override
    public int getItemCount() {
        return list == null ? 1 : list.size() + 1;
    }
}
